package Thread_.homework;

public class test6 {
    public static void main(String[] args) throws InterruptedException {
        Thread t=new Thread(){
            @Override
            public void run() {
                System.out.println("Thread开始执行");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
                System.out.println("Thread执行结束");
            }
        };
        t.run();
        while(true){
            System.out.println("main方法");
            Thread.sleep(1000);
        }
    } public static void main1(String[] args) throws InterruptedException {
        new Thread(){
            @Override
            public void run() {
                System.out.println("Thread开始执行");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
                System.out.println("Thread执行结束");
            }
        }.start();
        while(true){
            System.out.println("main方法");
            Thread.sleep(1000);
        }
    }
}
